import {BasicColumn, FormSchema} from '@/components/table';
import {render} from '@/hooks/render/renderUtils';
import {getDictTreeList} from "../data/dict.api";

export const columns: BasicColumn[] = [
  {
    title: '字典名称',
    dataIndex: 'dicDataTitle',
    width: 200,
  },
  {
    title: '排序值',
    dataIndex: 'sortOrder',
    width: 100,
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 200,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'dicDataTitle',
    label: '字典项',
    component: 'Input',
    colProps: {span: 3},
  }
];

export const formSchema: FormSchema[] = [
  {
    label: '分类编码',
    field: 'dicType',
    component: 'Input',
    required: true,
  },
  {
    label: '分类名称',
    field: 'dicTitle',
    component: 'Input',
    required: true,
  }
];

export const dictDataFormSchema: FormSchema[] = [
  {
    label: '字典分类',
    field: 'dictId',
    component: 'ApiSelect',
    required: true,
    componentProps: {
      api: getDictTreeList,
      labelField: 'dicTitle',
      valueField: 'dictId',
    },
  },
  {
    label: '字典项标题',
    field: 'dicDataTitle',
    component: 'Input',
    required: true,
  },
  {
    label: '字典项值',
    field: 'dicDataValue',
    show:false,
    component: 'Input',
  },
  {
    label: '排序值',
    field: 'sortOrder',
    component: 'Input',
  }
];

